<template>
  <div class="head">
    <h3>今日菜品销售</h3>
    <div class="xia">
      <el-table :data="tableData" style="width: 100%">
        <el-table-column
          prop="orderList[0].foodId"
          label="菜品编号"
          width="250"
        >
        </el-table-column>
        <el-table-column
          prop="orderList[0].foodName"
          label="菜品名称"
          width="250"
        >
        </el-table-column>
        <el-table-column prop="orderList[0].foodMoney" label="单价" width="250">
        </el-table-column>
        <el-table-column
          prop="orderList[0].foodDiscount"
          label="折扣力度"
          width="250"
        >
        </el-table-column>
        <el-table-column prop="orderList.length" label="订单数量" width="250">
        </el-table-column>
      </el-table>
    </div>
    <div class="block">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage1"
        :page-sizes="ye"
        :page-size="100"
        layout="total, sizes, prev, pager, next, jumper"
        :total="zongshu"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { findbyday } from "@/apis/zhaobaoyi/zhaobaoyi.js";
export default {
  data() {
    return {
      tableData: [],
      currentPage1: 1,
      zongshu: 0,
      ye: [5, 10, 15, 20],
      meiye: 5,
      dangye: 1,
    };
  },
  methods: {
    handleSizeChange(val) {
      this.meiye = `${val}`;
      findbyday(this.dangye, this.meiye).then((ok) => {
        this.tableData = ok.data.data;
      });
    },
    handleCurrentChange(val) {
      this.dangye = `${val}`;
      findbyday(this.dangye, this.meiye).then((ok) => {
        this.tableData = ok.data.data;
      });
    },
  },
  mounted() {
    findbyday(1, 500).then((ok) => {
      console.log(ok.data.data);
      this.zongshu = ok.data.data.length;
      findbyday(1, 5).then((ok) => {
        console.log(ok.data.data);
        this.tableData = ok.data.data;
      });
    });
  },
};
</script>

<style scoped>
h3 {
  width: 1273px;
  height: 45px;
  background-color: rgb(220, 220, 220);
}
.head {
  width: 1273px;
  border: 1px solid #000;
  margin-top: 7px;
}
.xia {
  width: 1273px;
  margin-left: 11.5px;
  border: 1px solid #000;
  margin-bottom: 10px;
  margin-top: 10px;
  text-align: center;
}
.cell {
  text-align: center;
}
.block {
  margin-left: 400px;
}
</style>